package action.UserAction;

import model.dao.UserDao;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

import domain.UserInfo;

public class ExecuteUser extends ActionSupport {
	
	public String insert() throws Exception {
		UserInfo users = (UserInfo) ServletActionContext.getRequest()
				.getSession().getAttribute("userinfo");
		UserDao userdao = new UserDao();
		userdao.AddUser(users.getUserName(), users.getUserPwd(), users
				.getUserSex(), users.getUserAge(), users.getUserRealName(),
				users.getUserTel(), users.getUserPlace(), users.getUserEmail());
		return SUCCESS;
	}

	public String update() throws Exception {
		UserInfo users = (UserInfo) ServletActionContext.getRequest()
				.getSession().getAttribute("userinfo");
		UserDao userdao = new UserDao();
		userdao.UpdateUser(users.getUserId(), users.getUserName(), users
				.getUserPwd(), users.getUserSex(), users.getUserAge(), users
				.getUserRealName(), users.getUserTel(), users.getUserPlace(),
				users.getUserEmail());
		return "updatesuccess";
	}

	
}
